<?php if (!defined('BASEPATH')) exit('No direct access allowed.');
class MY_Input extends CI_Input {

	public function __construct(){
		foreach($_POST as $k => $v)
			if(strpos($k, 'bbcode_') !== false){
				$this->_POST_RAW[$k] = $v;
				$_POST[$k] = html_escape($_POST[$k]);
			}
		parent::__construct();
	}

	public function get_bbcode($name = null){
		return @$this->_POST_RAW['bbcode_'.$name];
	}

	public function bbcode_value($name = null, $value = null){
		if(empty($name))
			return false;

		$bbcode = $this->get_bbcode($name);
		if(empty($bbcode))
			return $value;
		return $bbcode;
	}
}